import http from '@/utils/http/axios';
import { ContentTypeEnum } from "@/enums/httpEnum";
import qs from 'qs';
const baseInfoApi = {
  // 企业
  enterpriseList: '/baseInfo/enterprise/list',
  enterpriseDetail: '/baseInfo/enterprise/',
  saveEnterprise: '/baseInfo/enterprise',
  enableEnterprise: '/baseInfo/enterprise/enable/',
  disableEnterprise: '/baseInfo/enterprise/disable/',
  // 驾驶员
  driverList: '/baseInfo/driver/list',
  driverDetail: '/baseInfo/driver/',
  saveDriver: '/baseInfo/driver',
  // 协会
  associationList: '/baseInfo/association/list',
  associationDetail: '/baseInfo/association/',
  saveAssociation: '/baseInfo/association',
  // 车辆
  carList: '/baseInfo/car/list',
  carDetail: '/baseInfo/car/',
  saveCar: '/baseInfo/car',
  // 设备
  equipmentList: '/baseInfo/equipment/list',
  equipmentDetail: '/baseInfo/equipment/',
  saveEquipment: '/baseInfo/equipment',
  // 部门
  // departmentList: ''
  // 部门人员
};

export function getEnterpriseList(params) {
  return http.request({
    url: baseInfoApi.enterpriseList,
    method: 'GET',
    params: params,
  });
}

export function getEnterpriseDetail(id) {
  return http.request({
    url: baseInfoApi.enterpriseDetail + id,
    method: 'GET',
  });
}

export function saveEnterprise(data) {
  return http.request({
    url: baseInfoApi.saveEnterprise,
    method: 'PUT',
    // data,
    data: data,
    headers: {
      'Content-Type': ContentTypeEnum.FORM_URLENCODED,
    },
  });
}

export function addEnterprise(data) {
  return http.request({
    url: baseInfoApi.saveEnterprise,
    method: 'POST',
    data: data,
    headers: {
      'Content-Type': ContentTypeEnum.FORM_URLENCODED,
    },
  });
}

export function deleteEnterprise(id) {
  return http.request({
    url: baseInfoApi.enterpriseDetail + id,
    method: 'DELETE',
  });
}

export function disableEnterprise(id) {
  return http.request({
    url: baseInfoApi.disableEnterprise + id,
    method: 'PUT',
  });
}

export function enableEnterprise(id) {
  return http.request({
    url: baseInfoApi.enableEnterprise + id,
    method: 'PUT',
  });
}

export function getDriverList(params) {
  return http.request({
    url: baseInfoApi.driverList,
    method: 'GET',
    params: params,
  });
}

export function saveDriver(data) {
  return http.request({
    url: baseInfoApi.saveDriver,
    method: 'PUT',
    data,
  });
}

export function getDriverDetail(id) {
  return http.request({
    url: baseInfoApi.driverDetail + id,
    method: 'GET',
  });
}

export function deleteDriver(id) {
  return http.request({
    url: baseInfoApi.driverDetail + id,
    method: 'DELETE',
  });
}

export function addDriver(data) {
  return http.request({
    url: baseInfoApi.saveDriver,
    method: 'POST',
    data: qs.stringify(data),
    headers: {
      'Content-Type': ContentTypeEnum.FORM_URLENCODED,
    },
  });
}

// 协会

export function getAssoicationList(params) {
  return http.request({
    url: baseInfoApi.associationList,
    method: 'GET',
    params,
  });
}

export function getAssoicationDetail(id) {
  return http.request({
    url: baseInfoApi.associationDetail + id,
    method: 'GET',
  });
}

export function deleteAssoication(id) {
  return http.request({
    url: baseInfoApi.associationDetail + id,
    method: 'DELETE',
  });
}

// 设备

export function getEquipmentList() {
  return http.request({
    url: baseInfoApi.equipmentList,
    method: 'GET',
  });
}

export function getEquipmentDetail(id) {
  return http.request({
    url: baseInfoApi.equipmentDetail + id,
    method: 'GET',
  });
}

export function saveEquipment(data) {
  return http.request({
    url: baseInfoApi.saveEquipment,
    method: 'PUT',
    data,
  });
}

export function deleteEquipment(id) {
  return http.request({
    url: baseInfoApi.equipmentDetail + id,
    method: 'DELETE',
  });
}

// 车辆

export function getCarList() {
  return http.request({
    url: baseInfoApi.carList,
    method: 'GET',
  });
}

// 部门信息
//部门人员
